package com.boot.core.async.action;

import java.util.function.BiFunction;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description 降级返回值
 * @date 2023/3/9 21:06
 **/

public class FallbackHandler<R> extends AbstractFallbackHandler<R> implements BiFunction<R, Throwable, R> {
    public FallbackHandler(R fallbackValue) {
        super(fallbackValue);
    }

    public FallbackHandler(R fallbackValue, boolean nonNull) {
        super(fallbackValue, nonNull);
    }

    @Override
    public R apply(R r, Throwable throwable) {
        return fallback(r, throwable);
    }
}
